home *** CD-ROM | disk | FTP | other *** search
Java Source | 1996-08-21 | 771 b | 36 lines |
- /*
- musical.java : source for sound tutorial
- Written By : Jai Natarajan
- Sony Pictures Imageworks
- */
- import vrml.*;
- import vs.*;
-
- public class musical extends Script {
-
- SFTime musicOn = (SFTime)getEventOut("musicOn");
- SFTime musicOff = (SFTime)getEventOut("musicOff");
-
- boolean musicPlaying = false;
-
- public musical() { }
-
- public void clicked(ConstSFBool ev, ConstSFTime time) {
-
- double now = time.getValue();
-
- if(ev.getValue() == true) {
- return;
- }
- else {
- if(!musicPlaying) { // we need to switch it on
- musicOn.setValue(now);
- }
- else { // switch it off
- musicOff.setValue(now);
- }
- musicPlaying = !musicPlaying;
- }
- }
- }
-